package com.bookcloud.java21.chapter6.接口的扩展68;

public class InterfaceExtension {
  public static void main(String[] args) {
    // 实现调用接口
    Labrador labrador = new Labrador("拉布拉多");
    labrador.play();
    labrador.showAffection();
    labrador.bark();
    labrador.makeSound();
    labrador.makeSound("汪汪叫");
    labrador.move();
    // 实现多态
    System.out.println("=========== 多态调用=======");
    Animal animal = labrador;
    animal.eat();
    animal.sleep();
    // 多态调用接口方法
    System.out.println(" === Pet 接口方法 === ");
    Pet pet = labrador;
    pet.play();
    pet.showAffection();
    // Dog
    System.out.println(" === Dog 接口方法 === ");
    Dog dog = labrador;
    dog.bark();
    // Vocal
  }
}
